package day04;

import java.sql.SQLOutput;
import java.util.Scanner;

public class dayJudge {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("输入年份");
        int year = sc.nextInt();
        System.out.println("输入月份");
        int month = sc.nextInt();
        System.out.println("输入天数");
        int days = sc.nextInt();
        int result = 0;
        for (int i = month - 1; i > 0; i--) {
            result += monthDay(year, i);
        }
        System.out.println("这一天是全年的第:" + (result + days) + "天");
    }

    public static int monthDay(int year, int month) {
        int days = 0;
        switch (month) {
            case 1:
            case 3:
            case 5:
            case 7:
            case 8:
            case 10:
            case 12:
                days = 31;
                break;
            case 4:
            case 6:
            case 9:
            case 11:
                days = 30;
                break;
            case 2:
                if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) {
                    days = 29;
                } else {
                    days = 28;
                }
        }
        return days;
    }
}
